package com.hao.wms.filter;

import com.hao.wms.domain.Employee;
import com.hao.wms.util.UserContext;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class LoginIntercepter extends AbstractInterceptor{
    //检查是否有session如果没有重回登录页面
    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        Employee emp = UserContext.getUser();
        if(emp==null){
            return Action.LOGIN;
        }
        
        return invocation.invoke();
    }
}
